#!/usr/bin/perl
#############################################
#    Perl Programe from Hamy.Zhu            #
#    QQ   :5477887                          #
#    Email:zbz@cndns.com                    #
#    Msn  :zbz@cndns.com                    #
#    More Think,Less Speak                  #
#    More Doing,Less Day-Dream              #
#############################################
use strict;
use warnings;
use LWP::Simple;
use Encode;
use CGI qw(:standard);
print header(-charset=>"utf8");
my $ip = '8.8.8.8';
if (param()) {
    $ip=param("ip");
}
if ($ip ne "") {
		use IP::QQWry;
		#use Encode qw/encode decode/;
		my $dbfile = 'D:\wwwroot\licence\wwwroot\ipdata\QQWry.Dat';
		my $qqwry = IP::QQWry->new($dbfile);
		my $result = $qqwry->query($ip);
		$result = encode("utf-8",decode("gbk",$result));
		#$result = decode("utf-8",$result);
		print $result;
}